package com.itheima.dao;

import com.itheima.pojo.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;
import java.util.Set;

public interface RoleDao {
    public Set<Role> findByUserId(Integer userId);



    @Select("select * from t_role")
    List<Role> findAllRole();
    @Insert("insert into t_user_role(user_id,role_id) values(#{user_id},#{role_id})")
    void addRelation(Map<String, Integer> map);

    @Delete("delete from t_user_role where user_id=#{id}")
    void deleteRelationBetweenUserAndRole(int id);

    @Select("select role_id from t_user_role where user_id=#{id}")
    List<Integer> findRoleIdsByUserId(Integer id);
}
